cmake_minimum_required(VERSION 3.11)
project (pika)

#-------------------------------------------------------------------------------
# Take almost all warnings;
# Do not generate debug symbols;
# Optimization level 3;
# Using c++11;
# Optimization on architecture
#-------------------------------------------------------------------------------
# Disable GCC dual ABI on GCC 5.1 and higher

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    message("==>>Debug Model")
    SET(CMAKE_VERBOSE_MAKEFILE ON)
    add_definitions("-Wall -Wno-sign-compare -g -march=native -Wno-strict-aliasing -Wno-comment")
else()
    message("==>>Release Model")
    add_definitions("-Wall -Wno-sign-compare -O3 -march=native -Wno-strict-aliasing -Wno-comment")
endif()
#set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third/rocksdb/cmake")

#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
#SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#set(TBB_ROOT "${PROJECT_SOURCE_DIR}/third_party/tbb")
#include(${TBB_ROOT}/cmake/TBBBuild.cmake)
#tbb_build(TBB_ROOT ${TBB_ROOT} CONFIG_DIR TBB_DIR MAKE_ARGS)

find_package(Python3 REQUIRED COMPONENTS Interpreter)
#find_package(PythonLibs REQUIRED)
#-------------------------------------------------------------------------------
# Set include paths and library paths.
#-------------------------------------------------------------------------------
message("==>>${PROJECT_SOURCE_DIR}/include")
include_directories(
        ${PROJECT_SOURCE_DIR}/include
        ${PROJECT_SOURCE_DIR}
)
link_directories(
        ${PROJECT_SOURCE_DIR}/lib
)

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
#-------------------------------------------------------------------------------
# Declare packages in xLearn project.
#-------------------------------------------------------------------------------
add_subdirectory(third)
add_subdirectory(src)
